<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
	<head>
		<meta charset="utf-8">
		<title>批改试题</title>
		<script type="text/javascript">
			function checkNum(obj) {
			    obj.value = obj.value.replace(/[^\d.]/g, "");  //清除“数字”和“.”以外的字符
			    obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
			    obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
			    obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');//只能输入两个小数
			    if (obj.value.indexOf(".") < 0 && obj.value != "") {//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
			        obj.value = parseFloat(obj.value);
			    }
			}
		</script>
		<link href="css/app.css" rel="stylesheet">
		<link rel="stylesheet" href=""/>
		<link rel="stylesheet" href="../../static/css/exam/corexam.css"/>
	</head>
	<body>
		<div class="wrapper">
				<nav id="sidebar" class="sidebar js-sidebar">
					<div class="sidebar-content js-simplebar">
						<a class="sidebar-brand">
			      <span class="align-middle">考试系统</span>
			    </a>
			
						<ul class="sidebar-nav">
							<li class="sidebar-header">
										导航栏
									</li>
							
							
									<li class="sidebar-item">
										<a class="sidebar-link" href="teacher.html" th:if="${usertype} eq '0'" >
							  <i class="align-middle" data-feather="user"></i> <span class="align-middle">个人主页</span>
							</a>
							<a class="sidebar-link" href="/personpage3" th:if="${usertype} eq '1'" >
							  <i class="align-middle" data-feather="user"></i> <span class="align-middle">个人主页</span>
							</a>
							<a class="sidebar-link" href="admin.html" th:if="${usertype} eq '2'" >
							  <i class="align-middle" data-feather="user"></i> <span class="align-middle">个人主页</span>
							</a>
									</li>
							
									<li class="sidebar-item">
										<a class="sidebar-link" href="/myexam">
							  <i class="align-middle" data-feather="check-square"></i> <span class="align-middle">考试主页</span>
							</a>
									</li>
							
									<li class="sidebar-item">
										<a class="sidebar-link" href="/class">
							  <i class="align-middle" data-feather="book"></i> <span class="align-middle">课程主页</span>
							</a>
									</li>
							
									<li class="sidebar-item">
										<a class="sidebar-link" href="/questionbankpage">
							  <i class="align-middle" data-feather="map"></i> <span class="align-middle">题库练习</span>
							</a>
									</li>
									<li class="sidebar-item" th:if="${usertype} eq '0'">
												<a class="sidebar-link" href="/AddExaminfo">
									  <i class="align-middle" data-feather="file"></i> <span class="align-middle">上传考试</span>
									</a>
											</li>
						</ul>
					</div>
				</nav>
			
				<div class="main">
					<nav class="navbar navbar-expand navbar-light navbar-bg">
						<a class="sidebar-toggle js-sidebar-toggle">
							<i class="hamburger align-self-center"></i>
						</a>
			
						<div class="navbar-collapse collapse">
							<ul class="navbar-nav navbar-align">
								<li class="nav-item dropdown">
									<a class="nav-icon dropdown-toggle d-inline-block d-sm-none" href="#" data-bs-toggle="dropdown">
										<i class="align-middle" data-feather="settings"></i>
									</a>
			
									<a class="nav-link dropdown-toggle d-none d-sm-inline-block" href="#" data-bs-toggle="dropdown">
										<i class="align-middle me-2" data-feather="feather"></i>
										<span th:if="${usertype} eq '0'">老师</span>
										<span th:if="${usertype} eq '1'">学生</span>
										<span th:if="${usertype} eq '2'">管理员</span>
										<img src="images/someicon/teacher.jpg" class="avatar img-fluid rounded me-1" alt="老师" th:if="${usertype} eq '0'"/> 
										<img src="images/someicon/student.jpg" class="avatar img-fluid rounded me-1" alt="学生" th:if="${usertype} eq '1'"/> 
										<img src="images/someicon/admin.jpg" class="avatar img-fluid rounded me-1" alt="管理员" th:if="${usertype} eq '2'"/> 
										<span class="text-dark" th:utext="${usermail}"></span>
									</a>
									<div class="dropdown-menu dropdown-menu-end">
										<a class="dropdown-item" href="teacherinfoupdate" th:if="${usertype} eq '0'"><i class="align-middle me-1" data-feather="user"></i> 修改信息</a>
										<a class="dropdown-item" href="/newstudentInformation" th:if="${usertype} eq '1'"><i class="align-middle me-1" data-feather="user"></i>  修改信息</a>
										<a class="dropdown-item" href="admininfoupdate" th:if="${usertype} eq '2'"><i class="align-middle me-1" data-feather="user"></i>  修改信息</a>
										<div class="dropdown-divider"></div>
										<a class="dropdown-item" href="logout">Log out</a>
									</div>
								</li>
							</ul>
						</div>
					</nav>
		
			<script type="text/javascript" th:inline="javascript">
				function toValid(){
					var maxpoint=[[${qinfo.point}]];
					//var maxpoint=100;
					var givepoint=document.getElementById("givepoint").value;
					if (givepoint !="" && givepoint>=0 && givepoint<=maxpoint){
						return true;
						console.log("aaaa");
					}
					else{
						alert("请给出合理的分数");
						console.log("shabi");
						return false;
					}
				}
			</script>	
				<!--在这里写我自己的东西-->
			<main class="content">
				<div class="container-fluid p-0">
					<div class="row">
						<div class="col-md-3">
							<div class="examinfo">
								<div class="examtitle">
									<div class="forh3">
										<h2>考试信息</h2>
									</div>
								</div>
								<div class="subexaminfo">
									<div class="subsub">
										考试id:<p th:utext="${thisexaminfo.id}"></p>
									</div>
									<div class="subsub">
										考试科目:<p th:utext="${thisexaminfo.subject}">111</p>
									</div>
								</div>
								<div class="subexaminfo">
									<div class="subsub">
										开始时间:<p th:utext="${#dates.format(thisexaminfo.starttime, 'yyyy-MM-dd HH:mm')}"></p>
									</div>
									<div class="subsub">
										结束时间:<p th:utext="${#dates.format(thisexaminfo.endtime, 'yyyy-MM-dd HH:mm')}"></p>
									</div>
								</div>
							</div>
							<div class="corinfo">
								<div class="fortitle">
									<h2>批改信息</h2>
								</div>
								<div class="corlist">
									<div class="sub1">
										<div class="subsub">
											<span style="font-weight: 700;">序号</span>
										</div>
										<div class="subsub">
											<span style="font-weight: 700;">得分</span>
										</div>
									</div>
									<div class="sub2">
										<span style="font-weight: 700;">更多</span>
									</div>
								</div>
								<div class="corlist" th:each="i:${aidlist}">
									<div class="sub1">
										<div class="subsub">
											<span th:utext="${iStat.count}">序号</span>
										</div>
										<div class="subsub">
											<div th:if="${scorelist[iStat.index]} eq '-1'">
												<span>未批改</span>
											</div>
											<div th:if="${scorelist[iStat.index]} ne '-1'">
												<span th:utext="${scorelist[iStat.index]}"></span>
											</div>
										</div>
									</div>
									<div class="sub2">
										<span style="font-weight: 700;">
											<form action="/corqexam2" enctype='multipart/form-data' method='POST'>
												<button type="submit" style="width: 40px; height: 20px; border-radius: 20%;border: none;background-color: #17A2B8;">
													<input type="hidden" name="aid" th:value="${i}">
													<h5 style="margin-top:2px;">
														<font color="white">查看</font>
													</h5>
												</button>
											</form>
										</span>
									</div>
								</div>
							</div>
						</div>
						<div class="col-md-9">
							<div class="bigbox">
								<div class="forq">
									<div class="someinfo">
											<div class="subsub">
												题目id:
											</div>
											<div class="suba">
												<p th:utext="${qinfo.id}" style="font-weight:700;">123</p>
											</div>
											<div class="subsub">
												分值:
											</div>
											<div class="suba">
												<p th:utext="${qinfo.point}" style="font-weight:700;">123</p>
											</div>
											<div class="subsub">
												难度:
											</div>
											<div class="suba">
												<p th:if ="${qinfo.difficulty} eq '0.2'" style="font-weight:700;">简单</p>
												<p th:if ="${qinfo.difficulty} eq '0.5'" style="font-weight:700;">中等</p>
												<p th:if ="${qinfo.difficulty} eq '0.8'" style="font-weight:700;">困难</p>
											</div>
											<div class="suba"></div>
											<div class="suba"></div>
											<div class="suba"></div>
											<div class="suba"></div>
											<div class="subsub"></div>
											<div class="subsub"></div>
										</div>
										<div class="maininfo">
											<div class="forblank"></div>
											<div class="forreal">
												<p th:utext="${qinfo.content}">我是题干哈哈哈哈</p>
												<div th:if="${not #strings.isEmpty(qinfo.picture)}">
													<div class="forimg">
														<img th:src="@{${qinfo.picture}}" style="width: 100% ; height:100%">
													</div>		
												</div>
												<div class="forbig">
													<div class="subsub">
														<p style="font-weight:700;">正确答案：</p>
													</div>
													<div class="subsub2">
														<p th:utext="${qinfo.content}">我是答案哈哈哈哈哈哈哈哈哈哈哈哈哈哈或或或或或或或或或或或或或或或或或或或或或或或或或或或或或或</p>
													</div>
													<div class="subsub"></div>
													<div class="subsub"></div>
												</div>
												<div class="forbig" th:if="${not #strings.isEmpty(qinfo.picture)}">
													<div class="subsub">
														<p style="font-weight:700;">标答照片：</p>
													</div>
													<div class="subsub2">
														<div class="forimg">
															<img th:src="@{${qinfo.picture}}" style="width: 100% ; height:100%">
														</div>			
													</div>
													<div class="subsub"></div>
													<div class="subsub"></div>
												</div>
												<div class="forbig">
													<div class="subsub">
														<p style="font-weight:700;">
															<font color="red">学生答案</font>
													</div>
													<div class="subsub2">
														<p th:utext="${stuanswer}"></p>
													</div>
													<div class="subsub"></div>
													<div class="subsub"></div>
												</div>
												<div class="forbig" th:if="${not #strings.isEmpty(stuanswerpic)}">
													<div class="subsub">
														<p style="font-weight:700;">
															<font color="red">学生照片</font>
														</p>
													</div>
													<div class="subsub2">
														<div class="forimg">
															<img th:src="@{${stuanswerpic}}" style="width: 100% ; height:100%">
														</div>	
													</div>
													<div class="subsub"></div>
													<div class="subsub"></div>
												</div>
												<div class="forbig">
													<div class="subsub">
														<p style="font-weight:700;">
															<font color="orange">建议分数</font>
													</div>
													<div class="subsub2" >
														<input type="text" name="predictscore" th:value="${predictscore}" class="form-control"  readonly="readonly">
													</div>
													<div class="subsub"></div>
													<div class="subsub"></div>
												</div>
												<div class="forbig">
													<div class="subsub">
														<p style="font-weight:700;">
															<font color="blue">批改分数</font>
													</div>
													<div class="subsub2" th:if="${getscore} ne '-1'">
														<input type="text" name="getscore" th:value="${getscore}" class="form-control" form="doq" onkeyup="checkNum(this)" id="givepoint">
													</div>
													<div class="subsub2" th:if="${getscore} eq '-1'">
														<input type="text" name="getscore" class="form-control" form="doq" onkeyup="checkNum(this)" id="givepoint">
													</div>
													<div class="subsub"></div>
													<div class="subsub"></div>
												</div>
												<div class="forbig">
													<div class="subsub">
														<p style="font-weight:700;">
															<font color="darkgreen">批改评语</font>
													</div>
													<div class="subsub2">
														<textarea cols="80" rows="6"  name="comment" th:utext="${comment}" class="form-control" form="doq">(来自老师)</textarea>
													</div>
													<div class="subsub"></div>
													<div class="subsub"></div>
												</div>
											</div>
										</div>	
									</div>
									<div class="forsubmit">
										<form action="/corqexam3" enctype='multipart/form-data' method='POST' id="doq" onsubmit="return toValid()">
											<button type="submit" style="width: 80px; height: 40px; border-radius: 20%;border: none;background-color: #17A2B8;">
												<input type="hidden" name="aid" th:value="${aid}">
												<h4 style="margin-top:2px;">
													<font color="white">提交分数</font>
												</h4>
											</button>
										</form>
									</div>
									<div th:if="${not #strings.isEmpty(warning)}" class="warning">
										<div class="sub1">
											<p style="font-size:18px;padding-left:200px">
												<font color=red  th:utext="${warning}">
												本题已批改完成，返回批改下一道？	
												</font>
											</p>
										</div>
										<div class="sub2">
											<form class="form-horizontal" action="/Examdetail" enctype='multipart/form-data' method='POST'>
												<button type="submit" style="width: 120px; height: 40px; border-radius: 20%;border:none;background-color: #ffffff;margin-left:-100px">
													<input type="hidden" name="examid" th:value="${thisexaminfo.id}">
													<h4 style="margin-top:-4px;">
														<font color="blue">返回考试详情</font>
													</h4>
												</button>
											</form>
										</div>
									</div>
							</div>
						</div>
					</div>
				</div>
			</main>
				
			</div>
		</div>
		
		<script src="js/app.js"></script>
	</body>
</html>
